import * as home from './action-type';

let defaultState = {
  orderSum: 1234, //金额
  name: '我叫小黑', //姓名
  phoneNo: '15712345678', //手机号
  imgpath: 'www.baidu.com', //图片地址
}
// 首页表单数据
export const homeData = (state = defaultState , action = {}) => {
  switch(action.type){
    case home.SAVEFORMDATA:
      return {...state, ...{[action.datatype]: action.value}};
    case home.SAVEIMG:
      return {...state, ...{imgpath: action.path}};
    case home.CLEARDATA:
      return {...state, ...defaultState};
    default:
      return state;
  }
}

